package BehavioralMode.iterator.StudentDemo;

/**
 * 迭代器模式客户端类
 *
 * */
public class Client {

      public static void main(String[] args) {

            Student student1 = new Student("小红",15);
            Student student2 = new Student("小明",25);
            Student student3 = new Student("小红",15);

            AbstractagAggregate concreteAggregate = new ConcreteAggregate();
            concreteAggregate.addEle(student1);
            concreteAggregate.addEle(student2);
            concreteAggregate.addEle(student3);

            AbstractIterator concreteIterator = concreteAggregate.getIterator();
            while (concreteIterator.hasNext()){
                System.out.println(concreteIterator.getCurrentEle());
            }
      }

}
